<template>
  <div>
    <button @click="handleAddShopCar">加入购物车</button>
  </div>
</template>

<script>
import { mapMutations } from "vuex";
export default {
  data() {
    return {
      food: {},
    };
  },
  created() {
    this.food = this.$route.params;
  },
  methods: {
    ...mapMutations(["CHANGE_FOOD_COUNT"]),
    handleAddShopCar() {
      this.CHANGE_FOOD_COUNT({ id: this.food.id, type: "Add" });
    },
  },
};
</script>

<style lang="less" scoped>
</style>